<template>
    <div>
        <div class="banner" @click="handleImgClick">
            <img class="banner-img" :src="bannerImg" alt="">
            <div class="banner-info">
                <div class="banner-number">
                    <span class="iconfont img-icon">&#xe619;</span>
                    {{ this.gallaryImgs.length }}
                </div>
                <div class="banner-title">{{ sightName }}</div>
            </div>
        </div>
        <fade-animation>
          <common-gallery :imgs="gallaryImgs" v-show="showImg" @close="handleCloseClick"></common-gallery>
        </fade-animation>
    </div>
</template>

<script>
import CommonGallery from 'common/gallery/CommonGallery'
import FadeAnimation from 'common/fade/FadeAnimation'
export default {
  name: 'DetailBanner',
  props: {
    bannerImg: String,
    gallaryImgs: Array,
    sightName: String
  },
  data() {
    return {
      showImg: false
    }
  },
  methods: {
    handleImgClick() {
      this.showImg = true
    },
    handleCloseClick() {
      this.showImg = false
    }
  },
  components: {
    CommonGallery,
    FadeAnimation
  }
}
</script>

<style lang="stylus" scoped>
    .banner
      overflow hidden
      height 0
      padding-bottom 55%
      position relative
      .banner-img
        width 100%
      .banner-info
        color #fff
        position absolute
        bottom 0
        right 0
        left 0
        background-image linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.7))
        .banner-number
          width 1.2rem
          height .4rem
          line-height .4rem
          border-radius .2rem
          background rgba(0,0,0,.5)
          font-size .24rem
          text-align center
          margin-left .2rem
        .banner-title
          font-size .36rem
          margin .2rem 0 .2rem .2rem
</style>
